package com.syher.seconds.kill.kafka.core.configure;

import com.syher.seconds.kill.kafka.core.kafka.ConsumerGroup;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class KafkaConfig {

    @Value("${kafka.brokerList}")
    private String brokerList;

    @Value("${kafka.groupId}")
    private String groupId;

    @Value("${kafka.topic}")
    private String topic;

    @Value("${kafka.threadNum}")
    private int threadNum;

    @Bean(value = "consumerGroup")
    public ConsumerGroup createConsumerGroup() {
        return ConsumerGroup.builder().
                configure(threadNum, groupId, topic, brokerList);
    }
}
